<!DOCTYPE HTML>
<script src="../../../resources/js-test.js"></script>
<p id="description"></p>
<div id="console"></div>
<script>
    description("This test passes if it doesn't trigger an ASSERT - crbug.com/285299");

    window.jsTestIsAsync = true;

    function onDone()
    {
        finishJSTest();
    }

    var iframe = document.createElement('iframe');

    // When the iframe and it's child frame finish loading, remove both.  This should cleanup
    // the parent frame first, and then trigger the unload event in the child domain - triggering
    // the removal of it's final touch event handler.
    function loaded()
    {
        // Make sure we don't get fired repeatedly.
        iframe.removeEventListener('load', loaded);
        iframe.src = 'about:blank';
        window.setTimeout(onDone, 0);
    }
    iframe.addEventListener('load', loaded);

    document.body.appendChild(iframe);
    nestedDocument = iframe.contentWindow.document;
    nestedDocument.open('text/html', 'replace');
    nestedDocument.write('<!DOCTYPE html>\n<iframe src="resources/touch-handler-iframe-unload-assert-frame.html"></iframe>');
    nestedDocument.close();

</script>
